package cn.iocoder.yudao.module.bpm.dal.mysql.journalapplydetail;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.journalapplydetail.vo.JournalApplyDetailPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.journalapplydetail.JournalApplyDetailDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 期刊申请详情 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface JournalApplyDetailMapper extends BaseMapperX<JournalApplyDetailDO> {

    default void deleteByApplyId(Long applyId) {
        delete(JournalApplyDetailDO::getApplyId,applyId);
    }

    default PageResult<JournalApplyDetailDO> selectPage(JournalApplyDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<JournalApplyDetailDO>()
                .eqIfPresent(JournalApplyDetailDO::getJournalId, reqVO.getJournalId())
                .betweenIfPresent(JournalApplyDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(JournalApplyDetailDO::getId));
    }

    default List<JournalApplyDetailDO> getJournalApplyDetailList(Long applyId){
        return selectList(JournalApplyDetailDO::getApplyId,applyId);
    };
}